home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_tem_bossflood.cog < prev    next >
Text File  |  1999-11-15  |  26KB  |  1,042 lines

  1. # Jones 3D Cog Script
  2. #
  3. # TEM_BossFlood.cog
  4. #
  5. # [TRM]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. # ========================================================================================
  9.  
  10. symbols
  11.  
  12.     message        startup
  13.     message        activated
  14.     message        entered
  15.  
  16.     # ** local things **
  17.     thing        player                local
  18.     thing        t_Boss                local
  19. #    thing        sp0                    local
  20. #    thing        sp1                    local
  21. #    thing        sp2                    local
  22. #    thing        indyTarget            local
  23.     thing        indy
  24.     thing        sender                local
  25.     thing       pud                 local
  26.     thing       cool                local
  27.  
  28.     # ** meet boss cutscene stuff **
  29.     thing        meet_Cam1
  30.     thing        meet_Target1        # walk player to this
  31.     thing        meet_Target2        # secondary focus
  32.     sector        trig_BossCut
  33.     thing       offset_indy         # offset secondary focus
  34.     thing       backOff_Targ
  35.  
  36.     # ** get Imp2 stuff **
  37.     thing        imp_Stand
  38.     thing        imp_Part
  39.     thing        t_GhostImp
  40.     thing        imp_Cam1
  41.     thing        imp_Cam2
  42.     thing        imp_CamLook1
  43.     thing        imp_CamLook2
  44.     thing       imp_Orient
  45.     thing        flame0
  46.     thing        flame1
  47.  
  48.     surface        srf_trgr01
  49.  
  50.     # ** boss flood things **
  51.     thing        cam_sm0                local
  52.     thing        cam_sm1                local
  53.     thing        cam_sm2                local
  54.  
  55.     thing        wat_sm0                local
  56.     thing        wat_sm1                local
  57.     thing        wat_sm2                local
  58.  
  59. #    thing        bos_sm0                local
  60. #    thing        bos_sm1                local
  61. #    thing        bos_sm2                local
  62.  
  63.     # ** misc things **
  64.     thing        button
  65.     thing        mouth1                # water mask mouth
  66.     thing        mouth2                # lava mask mouth
  67.     thing        t_GhostMeet            # meet cutscene ghost
  68.     thing        t_GhostDie            # kill boss cutscene
  69.     thing        fader1                # fade to white
  70.     thing        targ_PosCam
  71.     thing        water_Flood
  72.     thing       explosion_Pos1      # water/lava explosion
  73.     thing       explosion_Pos2
  74.     thing       explosion_Pos3
  75.     thing       explosion_Pos4
  76.     thing       explosion_Pos5
  77.     thing       lava_Puddle
  78.     thing       light_Blue          # blue light pos when water enters
  79.     thing       but_Orient
  80.     
  81.     thing       boss1_Pos           # boss1 position
  82.     thing        boss1               # local                # cooled boss
  83.     
  84.     # ** Cameras **
  85.     thing        but_Cam1
  86.     thing        boss_Cam1
  87. #    thing        mask_cam1
  88.  
  89.     # ** Camera targets **
  90.     thing        targ_ButCam
  91.     thing        targ_BossCam
  92.     thing        targ_MaskCam
  93.  
  94.     # ** splash ghost pos **
  95.     thing        splash0                # NOT USED!
  96.     thing        splash1             # NOT USED!
  97.     thing        splash2             # NOT USED!
  98.  
  99.     # ** cam smoke ghost pos **
  100.     thing        cam_smoke0
  101.     thing        cam_smoke1
  102.     thing        cam_smoke2
  103.  
  104.     # ** water hits lava smoke ghost pos **
  105.     thing        wat_smoke0
  106.     thing        wat_smoke1
  107.     thing        wat_smoke2
  108.  
  109.     # ** water hits lava smoke ghost pos **
  110.     thing        bos_smoke0            # NOT USED!
  111.     thing        bos_smoke1          # NOT USED!
  112.     thing        bos_smoke2          # NOT USED!
  113.  
  114.     sector        sec_Water0
  115.     sector        sec_Water1
  116.     sector        sec_Water2
  117.     #sector        sec_Water3
  118.  
  119.     surface        surf_WatSurf0
  120.     surface        surf_WatSurf1
  121.     surface        surf_WatSurf2
  122.     surface        surf_WatSurf3
  123.     surface        surf_WatSurf4
  124.     surface        surf_WatSurf5
  125.  
  126.     surface        surf_Ledge0
  127.     surface        surf_Ledge1
  128.  
  129.     surface        surf_LavaCool0
  130.     surface        surf_LavaCool1
  131.     surface        surf_LavaCool2
  132.     surface        surf_LavaCool3
  133.     surface        surf_LavaCool4
  134.     surface        surf_LavaCool5
  135.  
  136.     surface        surf_LavaHot0
  137.     surface        surf_LavaHot1
  138.     surface        surf_LavaHot2
  139.  
  140.     surface        surf_LavaTrans0
  141.     surface        surf_LavaTrans1
  142.     surface        surf_LavaTrans2
  143.  
  144.     # ** templates **
  145. #    template    tpl_Boss=lava_boss                        local
  146. #    template    tpl_Splash=tem_medsplash                local
  147.     template    tpl_smoke=tem_spr_boss_smoke            local
  148.     template    tplActor=indy_sh_actor                    local
  149.     template    tpl_Ghost=ghost                            local
  150.     template    tpl_Debris=+lava_exp                    local
  151.     #template    tpl_Boss1=coollava_boss                 local
  152.     template    tpl_Boss1=coollava_bfc                  local
  153.     template    tpl_CoolLava=coolava                    local   # contracting spot
  154.     template    tpl_PoolLava=poolava                    local   # pool
  155.  
  156.     # ** boss keyframes **
  157.     keyframe    lb_Die=lb_die.key                        local
  158.  
  159.     # ** indy thinking keyframes **
  160.     keyframe    inStand1=0in_stand4.key                    local
  161.     keyframe    inThinking=0in_thinking_4_4.key            local
  162.     keyframe    inStand2=0in_stand1_bd_4.key            local
  163.  
  164.     # ** indy kneeling keyframes **
  165.     keyframe    kneel=0in_stand6.key                    local
  166.     keyframe    kneelDown=0in_stand1_bd_6.key            local
  167.     keyframe    standUp=0in_stand6_bd_1.key                local
  168.     
  169.     # ** misc indy keyframes **
  170.     keyframe    indy_Startled=0in_startled_1_1.key      local
  171.  
  172.     # ** materials **
  173.     material    mat1=tem_lava_floor_cooled.mat            local
  174.     material    mat2=tem_alava_flow2cooled.mat            local
  175.     material    mat3=tem_alava_flow2cooled_b.mat        local
  176.     material    mat4=gen_a_lavab128.mat                    local
  177.     material    mat_Cool=tem_a4_lava_cools.mat          local   # cooling lava
  178.     material    mat_Pool=tem_a_lava_pool.mat            local   # puddle
  179. #    material    mat_Splash=riv_a4sprite_rocksplash.mat    local
  180.  
  181.     # ** sound fx **
  182.     sound        sfx_LavaCool=tem_lava_water_cool_c.wav    local
  183.     sound        sfx_Mouth=tem_lava_mouth_c.wav            local
  184.     sound        sfx_WaterRush=tem_lava_water_rush_c.wav    local
  185.     sound        burning=gen_torch_burnin_c.wav            local
  186.     sound        lite=gen_torchlitet_c.wav                local
  187.  
  188.     # ** indy voice lines **
  189.     sound        inSay1=Tm04j01.wav                        local    # wow what's this guys body temp...
  190.     sound        in_Read1=Tm05j01.wav                    local    # Is this what I think it is...
  191.     sound        in_Read2=Tm05j02.wav                    local    # the unseen is unstoppable.
  192.     sound        say_Imp1=Tm05j03.wav                    local    # ...another cog in the wheel.
  193.     sound       say_Great=Inxj014.wav                   local   # oh great!
  194.     sound       say_What=Inxj012.wav                    local   # now what?
  195.  
  196.     # ** music **
  197.     sound        mus_Cue=mus_gen_fullaction.wav            local
  198.     sound        mus_Imp=mus_gen_machinepart.wav            local
  199.     sound        mus_Flood=mus_olv_snakedead.wav            local
  200.  
  201.     # ** boss sounds **
  202.     sound        snd_BossDie=tem_boss_death_c.wav        local
  203.     sound       snd_BossRoar=fol_lw_wakeup.wav          local
  204.  
  205.     # ** cogs **
  206. #    cog            talkCog            local
  207.     cog            cog_boss
  208.     cog            cog_Debris
  209.     cog            cog_Shake
  210.     cog            cog_Bubbles
  211.     cog         cog_Hint
  212.  
  213.     vector        smokeStart        local
  214.     vector        smokeEnd        local
  215.     vector        wat_Start        local
  216.     vector        wat_End            local
  217.     vector        bos_Start        local
  218.     vector        bos_End            local
  219.     vector        minLite            local
  220.     vector        camFocus        local
  221.  
  222.     # ** subroutines **
  223.     flex        getImp2            local
  224.     flex        readAgain        local
  225.     flex        killBoss        local
  226.  
  227.     int            curCam            local
  228.     int            animTrack        local
  229.     int            animId            local
  230.     int            voiceChannel    local
  231.     int            inTrack            local
  232.     int            kneeltrack        local
  233.     int            cool=0            local
  234. #    int            hot=0            local
  235.     int            trans=0            local
  236.     int            playing=0        local
  237.     int            visit=0            local
  238.     int            ready=0            local
  239.     int            torches=0        local
  240.     int            done=0            local
  241.     int         pool_Track      local
  242.     int         cool_Track      local
  243.  
  244.     int            numCool=6        local
  245. #    int            numHot=3        local
  246.     int            numTrans=3        local
  247.     int            numTorches=2    local
  248.  
  249.     int            n_BossCreated=0    local
  250.  
  251. end
  252.  
  253. # ========================================================================================
  254.  
  255. code
  256.  
  257. startup:
  258.  
  259.     player = GetLocalPlayerThing();
  260.     
  261.     #ThingFadeAnim(boss1, 1, 0, 0.1, 0);
  262.     #ThingFadeAnim(fader1, 1, 0, 0.1, 0);
  263.     SetThingAlpha(fader1, 0.0);
  264.  
  265.     # animate 128 lava texture
  266.     animTrack = MaterialAnim(mat4, 5.0, 1);
  267.  
  268.     # vector stuff
  269.     smokeStart = VectorSet(1.2, 1.2, 0.5);
  270.     smokeEnd = VectorSet(4.2, 4.2, 0.0);
  271.  
  272.     wat_Start = VectorSet(1.3, 1.3, 0.5);
  273.     wat_End = VectorSet(2.5, 2.5, 0.0);
  274.  
  275.     bos_Start = VectorSet(1.0, 1.0, 0.5);
  276.     bos_End = VectorSet(2.0, 2.0, 0.0);
  277.  
  278.     # torch stuff
  279.     minLite = VectorSet(0.87, 0.55, 0.06);
  280.  
  281.     # hide torch flames
  282.     SetThingFlags(flame0, 0x10);
  283.     SetThingFlags(flame1, 0x10);
  284.     
  285.     # add some light to imp stuff
  286.     SetThingLight(imp_Stand, '0.25 0.25 0.25', 0.001, 0.1);
  287.     SetThingLight(imp_Part, '0.25 0.25 0.25', 0.001, 0.1);
  288.     
  289.     # add some light to mouths
  290.     SetThingLight(mouth1, '1.0 1.0 1.0', 0.001, 0.1);
  291.     SetThingLight(mouth2, '0.25 0.15 0.15', 0.001, 0.1);
  292.     
  293.     return;
  294.  
  295. # ========================================================================================
  296.  
  297. entered:
  298.  
  299.     sender = GetSenderRef();
  300.  
  301.     if ((sender == trig_BossCut) && (!n_BossCreated))
  302.     {
  303.         # play music cue
  304.         PlaySoundLocal(mus_Cue, 1.0, 0.0, 0x0, 0);
  305.  
  306.         # do cutscene stuff
  307.         MakeMeStop();
  308.         StartCutscene(2);
  309.         
  310.         # attach secondary offset to indy actor
  311.         AttachThingToThing(offset_indy, indy);
  312.         
  313.         # put away any weapon
  314.         DeselectWeaponWait(player);
  315.         
  316.         # create indy actor
  317.         #indy = CreateThing(tplActor, player);
  318.         #CaptureThing(indy);
  319.         
  320.         # outfit indy actor
  321.         CopyPlayerHolsters(player, indy);
  322.  
  323.         # hide player show actor
  324.         SetThingFlags(player, 0x80000);
  325.         ClearThingFlags(indy, 0x80000);
  326.         
  327.         # Cut to meet_Cam1
  328.         SetCameraFocus(2, meet_Cam1);
  329.         SetCameraSecondaryFocus(2, offset_indy);
  330.         SetCurrentCamera(2);
  331.         SetCameraFOV(90, 0, 0.0);
  332.  
  333.         # change secondary focus to indy
  334.         #SetCameraSecondaryFocus(2, indy);
  335.  
  336.         # walk actor to target1
  337.         AISetCutsceneMode(indy);
  338.         AISetMoveSpeed(indy, 1.0);
  339.         AISetLookThing(indy, meet_Target1);
  340.         AISetMoveThing(indy, meet_Target1, 1);
  341.         
  342.         #Sleep(0.1);
  343.         #ResetThing(indy);
  344.         
  345.         # turn on look interp
  346.         SetCameraInterpSpeed(2, 2.0);
  347.         SetCameraLookInterp(2, 1);
  348.         Sleep(0.01);
  349.         SetCameraSecondaryFocus(2, meet_Target2);
  350.  
  351.         # Send special 'Create' Boss msg to boss AI cog
  352.         n_BossCreated = 1;
  353.         t_Boss = SendMessageEx(cog_Boss, USER0, t_GhostMeet, 0, 0, 0);
  354.  
  355.         Sleep(1.0);
  356.         
  357.         AISetMoveSpeed(indy, 1.0);
  358.         AISetMoveThing(indy, backOff_Targ, 1);
  359.  
  360.         # indy jumps back
  361.         #PlayVoice(indy, say_What, 1.0, 0);
  362.         #PlayForceMoveMode(indy, 5);
  363.         Sleep(1.0);
  364.         
  365.         #MoveToFrame(meet_Cam1, 1, 2.0);
  366.         
  367.         # say voice line
  368.         voiceChannel = PlayVoice(indy, inSay1, 1.0, 0);
  369.  
  370.         inTrack = PlayKey(indy, inStand1, 2, 0x0, 0);
  371.         PlayKey(indy, inStand2, 4, 0x12, 1);
  372.         PlayKey(indy, inThinking, 4, 0x12, 1);
  373.         StopKey(indy, inTrack, 0.5);
  374.         WaitForSound(voiceChannel);
  375.  
  376.         # Get the player into position
  377.         CopyOrientAndPos(indy, player);
  378.         
  379.         # rest before returning control
  380.         Sleep(0.25);
  381.         
  382.         # hide actor show player
  383.         SetThingFlags(indy, 0x80000);
  384.         ClearThingFlags(player, 0x80000);
  385.  
  386.         # turn off look interp
  387.         SetCameraLookInterp(2, 0);
  388.         Sleep(0.01);
  389.  
  390.         # Reset the camera
  391.         Sleep(0.5);
  392.         SetCurrentCamera(1);
  393.  
  394.         # Return control to player
  395.         ClearActorFlags(player, 0x200000);
  396.         EndCutscene();
  397.         
  398.         # initialize boss for play
  399.         SendMessage(cog_Boss, user2);
  400.     }
  401.  
  402. #    if((sender == srf_trgr01) && (ready == 1))
  403. #    {
  404.         # turn off falling debris
  405.         #SendMessage(cog_Debris, user1);
  406.  
  407.         # turn off camera shake
  408.         #SendMessage(cog_Shake, user1);
  409. #    }
  410.  
  411. return;
  412.  
  413. # ===================================================================
  414.  
  415. activated:
  416.  
  417. # ******************    
  418. # ** pick up IMP2 **
  419. # ******************
  420.  
  421.     sender = GetSenderRef();
  422.  
  423.     # activate imp part
  424.     if((sender == imp_Stand) || (sender == imp_Part))
  425.     {
  426.         if (visit < 1)
  427.         {
  428.             visit = 1;
  429.             Call getImp2;
  430.         }
  431.  
  432.         else if ((visit > 0) && (playing == 0))
  433.         {
  434.             playing = 1;
  435.             Call readAgain;
  436.         }
  437.     }
  438.  
  439. # ****************
  440. # ** boss flood **
  441. # ****************
  442.  
  443.     # activate flood button
  444.     else if((sender == button) && (done == 0))
  445.     {
  446.         done = 1;
  447.         curCam = GetCurrentCamera();
  448.  
  449.         Call killBoss;
  450.     }
  451.  
  452. return;
  453.  
  454. # ========================================================================================
  455.  
  456. getImp2:
  457.  
  458.     # solve hint40
  459.     SendMessage(cog_Hint, user0);
  460.     
  461.     # do cutscene stuff
  462.     MakeMeStop();
  463.     StartCutscene(2);
  464.     
  465.     # orient the player to the imp stand
  466.     CopyOrientAndPos(imp_Orient, player);
  467.     
  468.     # put away any weapon
  469.     DeselectWeaponWait(player);
  470.  
  471.     # offset the camera
  472.     SetExtCamOffsetToThing(imp_Cam1);
  473.     SetExtCamLookOffsetToThing(imp_CamLook1);
  474.  
  475.     # create indy actor
  476.     indy = CreateThing(tplActor, player);
  477.     CaptureThing(indy);
  478.  
  479.     # outfit indy actor
  480.     CopyPlayerHolsters(player, indy);
  481.  
  482.     # hide player show actor
  483.     SetThingFlags(player, 0x80000);
  484.     ClearThingFlags(indy, 0x80000);
  485.  
  486.     # kneel down
  487.     PlayKey(indy, kneelDown, 2, 0x12, 1);
  488.     kneeltrack = PlayKey(indy, kneel, 2, 0x14, 0);
  489.  
  490.     # say first visit line
  491.     PlayVoice(indy, in_Read1, 1.0, 1);
  492.  
  493.     # stand up
  494.     StopKey(indy, kneeltrack, 0.0);
  495.     PlayKey(indy, standUp, 2, 0x12, 1);
  496.  
  497.     # make indy look at imp_Part
  498.     AISetLookThing(indy, imp_Part);
  499.     
  500.     Sleep(0.5);
  501.  
  502.     # reach for imp_Part
  503.     PlayMode(indy, 60, 0);
  504.     Sleep(0.3);
  505.  
  506.     # play Imp part music cue
  507.     PlaySoundLocal(mus_Imp, 1.0, 0.0, 0x0, 0);
  508.  
  509.     # pick up the imp_Part
  510.     PlayMode(player, 60, 0);
  511.     Sleep(0.3);
  512.     DestroyThing(imp_Part);
  513.  
  514.     # Call the Pickup Lines cog
  515.     #talkCog = GetCogByIndex(0);
  516.     #SendMessage(talkCog, 27);
  517.  
  518.     # sleep to wait for talkCog
  519.     #Sleep(1.3);
  520.  
  521.     # add tiki2 to inventory
  522.     SetInvAvailable(player, 15, 1);
  523.     ChangeInv(player, 15, 1.0);
  524.     JonesInvItemChanged(15);
  525.  
  526.     # Johnny, tell the player what he's picked up
  527.     PlayVoice(indy, say_Imp1, 1.0, 1);
  528.  
  529.     # light statue flames
  530.     for (torches=0; torches<numTorches; torches=torches+1)
  531.     {
  532.         ClearThingFlags(flame0[torches], 0x10);
  533.         PlaySoundThing(lite, flame0[torches], 1.0, 5, 15, 0x0);
  534.         SetThingLight(flame0[torches], minlite, 0.5, 0.1);
  535.         PlaySoundThing(burning, flame0[torches], 1.0, 10, 25, 0x0001);
  536.         Sleep(0.1); # so torch sfx wont play over each other
  537.     }
  538.  
  539.     # switch to imp_Cam2
  540.     SetCameraFocus(2, imp_Cam2);
  541.     SetCameraSecondaryFocus(2, imp_CamLook2);
  542.     SetCurrentCamera(2);
  543.     SetCameraFOV(90, 0, 0.0);
  544.  
  545.     # turn on falling debris
  546.     SendMessage(cog_Debris, user0);
  547.  
  548.     # shake the place
  549.     SendMessage(cog_Shake, user0);
  550.     
  551.     Sleep(1.0);
  552.  
  553.     # bring in boss behind alter (USER3 == teleport msg)
  554.     SendMessageEx(cog_Boss, USER3, t_GhostImp, 0, 0, 0);
  555.     AISetLookThing(t_Boss, indy);
  556.  
  557.     # Put boss into 'angry mode'
  558.     SendMessage(GetThingClassCog(t_boss), USER0);
  559.  
  560.     Sleep(0.5);
  561.     
  562.     # play startled animation
  563.     PlayKey(indy, indy_Startled, 4, 0x12, 0);
  564.     
  565.     # say "oh great!"
  566.     PlayVoice(indy, say_Great, 1.0, 1);
  567.     
  568.     # stop unfinished animations
  569.     ResetThing(player);
  570.     
  571.     Sleep(1.0);
  572.     
  573.     # Get the player into position
  574.     CopyOrientAndPos(indy, player);
  575.     
  576.     # hide actor show player
  577.     SetThingFlags(indy, 0x80000);
  578.     ClearThingFlags(player, 0x80000);
  579.  
  580.     # restore camera to player
  581.     SetCameraPosition(1, GetThingPos(imp_Cam1));
  582.     Sleep(0.01);
  583.     SetCurrentCamera(1);
  584.     RestoreExtCam();
  585.  
  586.     # restore controls
  587.     ClearActorFlags(player, 0x200000);
  588.     EndCutscene();
  589.     
  590.     Sleep(2.0);
  591.     
  592.     # turn off falling debris
  593.     SendMessage(cog_Debris, user1);
  594.  
  595.     # turn off camera shake
  596.     SendMessage(cog_Shake, user1);
  597.  
  598.     ready = 1;
  599.  
  600.     return;
  601.  
  602. # ========================================================================================
  603.  
  604. readAgain:
  605.  
  606.     # do cutscene stuff
  607.     MakeMeStop();
  608.     StartCutscene(2);
  609.  
  610.     # orient the player to the imp stand
  611.     CopyOrientAndPos(imp_Orient, player);
  612.     
  613.     # put away any weapon
  614.     DeselectWeaponWait(player);
  615.     
  616.     # offset the camera
  617.     SetExtCamOffsetToThing(imp_Cam1);
  618.     SetExtCamLookOffsetToThing(imp_CamLook1);
  619.  
  620.     # create indy actor
  621.     indy = CreateThing(tplActor, player);
  622.     CaptureThing(indy);
  623.  
  624.     # outfit indy actor
  625.     CopyPlayerHolsters(player, indy);
  626.  
  627.     # hide player show actor
  628.     SetThingFlags(player, 0x80000);
  629.     ClearThingFlags(indy, 0x80000);
  630.  
  631.     # kneel down
  632.     PlayKey(indy, kneelDown, 2, 0x12, 1);
  633.     kneeltrack = PlayKey(indy, kneel, 2, 0x14, 0);
  634.     
  635.     # say second visit line
  636.     PlayVoice(indy, in_Read2, 1.0, 1);
  637.     
  638.     # stand up
  639.     StopKey(indy, kneeltrack, 0.0);
  640.     PlayKey(indy, standUp, 2, 0x12, 1);
  641.     
  642.     # Get the player into position
  643.     CopyOrientAndPos(indy, player);
  644.     
  645.     # hide actor show player
  646.     SetThingFlags(indy, 0x80000);
  647.     ClearThingFlags(player, 0x80000);
  648.  
  649.     RestoreExtCam();
  650.  
  651.     ClearActorFlags(player, 0x200000);
  652.     EndCutscene();
  653.  
  654.     playing = 0;
  655.  
  656.     return;
  657.  
  658. # ========================================================================================
  659.  
  660. killBoss:
  661.  
  662.     # solve hint44
  663.     SendMessage(cog_Hint, user0);
  664.     
  665.     # do cutscene stuff
  666.     MakeMeStop();
  667.     StartCutscene(2);
  668.  
  669.     # turn off lava bubbles
  670.     SendMessage(cog_Bubbles, user0);
  671.  
  672.     # switch to button cam
  673.     SetCameraFocus(2, but_cam1);
  674.     SetCameraSecondaryFocus(2, targ_butCam);
  675.     SetCurrentCamera(2);
  676.     SetCameraFOV(90, 0, 0.0);
  677.     
  678.     # orient player to button
  679.     #CopyOrientAndPos(but_Orient, player);
  680.     
  681.     # put away any weapon
  682.     DeselectWeaponWait(player);
  683.  
  684.     # activate button
  685.     PlayMode(player, 60, 0);
  686.     Sleep(0.3);
  687.  
  688.     # push button
  689.     MoveToFrame(button, 1, 1.0);
  690.     WaitForStop(button);
  691.  
  692.     # open the water mouth
  693.     MoveToFrame(mouth1, 1, 1.0);
  694.     PlaySoundThing(sfx_Mouth, mouth1, 1.0, 15.0, 25.0, 0);
  695.  
  696.     #Sleep(0.5);
  697.     #sp0 = CreateThing(tpl_splash, splash0);
  698.     #CaptureThing(sp0);
  699.     #sp1 = CreateThing(tpl_splash, splash1);
  700.     #CaptureThing(sp1);
  701.     #sp2 = CreateThing(tpl_splash, splash2);
  702.     #CaptureThing(sp2);
  703.  
  704.     #MaterialAnim(mat_Splash, 8.0, 1);
  705.  
  706.     Sleep(1.0);
  707.  
  708.     # play rushing water sfx
  709.     PlaySoundThing(sfx_WaterRush, mouth1, 1.0, 15.0, 25.0, 0);
  710.  
  711.     # destroy splash sprites
  712.     #DestroyThing(sp0);
  713.     #DestroyThing(sp1);
  714.     #DestroyThing(sp2);
  715.  
  716.     WaitForStop(mouth1);
  717.  
  718.     Sleep(0.5);
  719.  
  720. # ***************************
  721. # *** switch to mask2 cam ***
  722. # ***************************
  723.  
  724.     SetCameraFocus(2, boss_cam1);
  725.     SetCameraSecondaryFocus(2, targ_MaskCam);
  726.     SetCurrentCamera(2);
  727.     SetCameraFOV(90, 0, 0.0);
  728.  
  729.     # set fog to red
  730.     SetFog(1, '0.5, 0.05 0.05', 15, 180);
  731.  
  732. # *******************************
  733. # *** switch water OFF camera ***
  734. # *******************************
  735.  
  736.     # turn off water sectors
  737.     ClearSectorFlags(sec_Water0, 0x2);
  738.     ClearSectorFlags(sec_Water1, 0x2);
  739.     ClearSectorFlags(sec_Water2, 0x2);
  740.     
  741.     # clear water atributes from water sectors 
  742.     ClearSectorSurfFlags(sec_Water0, 0x20000);
  743.     ClearSectorSurfFlags(sec_Water1, 0x20000);
  744.     ClearSectorSurfFlags(sec_Water2, 0x20000);
  745.     
  746.     # alter the light of the water sectors
  747.     SetSectorLight(sec_Water0, '0.5 0.5 0.8', 0.1);
  748.     SetSectorLight(sec_Water1, '0.5 0.5 0.8', 0.1);
  749.     SetSectorLight(sec_Water2, '0.5 0.5 0.8', 0.1);
  750.     
  751.     # turn off water surfaces
  752.     SetFaceGeoMode(surf_WatSurf0, 0);       # no draw
  753.     SetFaceGeoMode(surf_WatSurf1, 0);
  754.     SetFaceGeoMode(surf_WatSurf2, 0);
  755.     SetFaceGeoMode(surf_WatSurf3, 0);
  756.     SetFaceGeoMode(surf_WatSurf4, 0);
  757.     SetFaceGeoMode(surf_WatSurf5, 0);
  758.  
  759.     # alter ledge atributes
  760.     SetSurfaceFlags(surf_Ledge0, 0x1000000);    # mark as hangable
  761.     SetSurfaceFlags(surf_Ledge1, 0x1000000);
  762.  
  763. # ******************************
  764. # *** water enters boss room ***
  765. # ******************************
  766.  
  767.     SetThingLight(light_Blue, '0.15 0.15 1.0', 0.5, 1.0);
  768.     
  769.     # open mouth2 to let water in
  770.     MoveToFrame(mouth2, 1, 1.0);
  771.     PlaySoundThing(sfx_Mouth, mouth2, 1.0, 15.0, 25.0, 0);
  772.  
  773.     SetThingLight(water_Flood, '0.5 0.5 1.0', 0.001, 0.1); # 10.0 dist
  774.     
  775.     Sleep(0.25);
  776.     # bring in the water_Flood
  777.     MoveToFrame(water_Flood, 1, 8.0);
  778.  
  779.     Sleep(0.5);
  780.  
  781.     # play water sound
  782.     PlaySoundLocal(sfx_LavaCool, 1.0, 0.0, 0x0, 0);
  783.  
  784.     # create explosions of water hitting lava
  785.     CreateThing(tpl_Debris, explosion_Pos1);
  786.     CreateThing(tpl_Debris, explosion_Pos2);
  787.     
  788.     Sleep(0.5);
  789.     
  790.     CreateThing(tpl_Debris, explosion_Pos1);
  791.     CreateThing(tpl_Debris, explosion_Pos2);
  792.     
  793.     # create water smoke
  794.     wat_sm0 = CreateThing(tpl_smoke, wat_smoke0);
  795.     CaptureThing(wat_sm0);
  796.     wat_sm1 = CreateThing(tpl_smoke, wat_smoke1);
  797.     CaptureThing(wat_sm1);
  798.     wat_sm2 = CreateThing(tpl_smoke, wat_smoke2);
  799.     CaptureThing(wat_sm2);
  800.  
  801.     # animate water smoke
  802.     AnimateSpriteSize(wat_sm0, wat_Start, wat_End, 1.5);
  803.     AnimateSpriteSize(wat_sm1, wat_Start, wat_End, 1.5);
  804.     AnimateSpriteSize(wat_sm2, wat_Start, wat_End, 1.5);
  805.  
  806.     #WaitForStop(mouth2);
  807.     #Sleep(0.5);
  808.     
  809. # ***********************************
  810. # *** block out camera with smoke ***
  811. # ***********************************
  812.  
  813.     # create camera smoke
  814.     cam_sm0 = CreateThing(tpl_smoke, cam_smoke0);
  815.     CaptureThing(cam_sm0);
  816.     cam_sm1 = CreateThing(tpl_smoke, cam_smoke1);
  817.     CaptureThing(cam_sm1);
  818.     cam_sm2 = CreateThing(tpl_smoke, cam_smoke2);
  819.     CaptureThing(cam_sm2);
  820.  
  821.     # fade to white
  822.     ThingFadeAnim(fader1, 0, 1, 1.0, 0);
  823.  
  824.     AnimateSpriteSize(cam_sm1, smokeStart, smokeEnd, 3.0);
  825.  
  826.     Sleep(1.0);
  827.  
  828. # ********************
  829. # *** change lava ****
  830. # ********************
  831.  
  832.     for (cool=0; cool<numCool; cool=cool+1)
  833.     {
  834.         SetSurfaceMat(surf_LavaCool0[cool], mat1);
  835.         ClearSurfaceFlags(surf_LavaCool0[cool], 0x200000);      # clear lava flag
  836.         #SetFaceLightMode(surf_LavaCool0[cool], 3);              # gouraud lighting
  837.     }
  838.  
  839.     # swap HOT transition textures
  840.     SetSurfaceMat(surf_LavaHot0, mat3);
  841.     SetSurfaceMat(surf_LavaHot1, mat2);
  842.     SetSurfaceMat(surf_LavaHot2, mat2);
  843.  
  844.     # clear lava flag from COOL transition texture
  845.     for (trans=0; trans<numtrans; trans=trans+1)
  846.     {
  847.         ClearSurfaceFlags(surf_Lavatrans0[trans], 0x200000);    # clear lava flag
  848.         #SetFaceLightMode(surf_Lavatrans0[trans], 3);    # gouraud lighting
  849.     }
  850.  
  851.     # swap COOL transition textures
  852.     SetSurfaceMat(surf_Lavatrans0, mat3);
  853.     SetSurfaceMat(surf_Lavatrans1, mat2);
  854.     SetSurfaceMat(surf_Lavatrans2, mat2);
  855.  
  856.     # reset all animating textures to frame0
  857.     StopAnim(animTrack);
  858.     SetMaterialCel(mat2, 0);
  859.     SetMaterialCel(mat3, 0);
  860.     SetMaterialCel(mat4, 0);
  861.  
  862.     # animate lava transition texture
  863.     MaterialAnim(mat2, 5.0, 1);
  864.     MaterialAnim(mat3, 5.0, 1);
  865.     MaterialAnim(mat4, 5.0, 1);
  866.  
  867. # **************************
  868. # *** look towards boss ****
  869. # **************************
  870.  
  871.     # Destroy water smoke sprites
  872.     DestroyThing(wat_sm0);
  873.     DestroyThing(wat_sm1);
  874.     DestroyThing(wat_sm2);
  875.  
  876.     # fade back in to show cooled lava
  877.     ThingFadeAnim(fader1, 1, 0, 0.5, 0);
  878.  
  879.     # add more smoke around camera
  880.     AnimateSpriteSize(cam_sm2, smokeStart, smokeEnd, 4.0);
  881.     
  882.     # show lava pool
  883.     pud = CreateThing(tpl_PoolLava, lava_Puddle);
  884.     CaptureThing(pud);
  885.     pool_Track = MaterialAnim(mat_Pool, 8.0, 1);
  886.  
  887.     # rest for a bit if necessary
  888.     Sleep(0.5);
  889.  
  890.     # look at the boss guy
  891.     SetCameraLookInterp(2, 1);
  892.     Sleep(0.01);
  893.     SetCameraSecondaryFocus(2, targ_BossCam);
  894.  
  895.     # add more smoke around camera
  896.     AnimateSpriteSize(cam_sm0, smokeStart, smokeEnd, 4.0);
  897.  
  898.     # create smoke around boss
  899.     #bos_sm0 = CreateThing(tpl_smoke, bos_smoke0);
  900.     #CaptureThing(bos_sm0);
  901.     #bos_sm1 = CreateThing(tpl_smoke, bos_smoke1);
  902.     #CaptureThing(bos_sm1);
  903.     #bos_sm2 = CreateThing(tpl_smoke, bos_smoke2);
  904.     #CaptureThing(bos_sm2);
  905.  
  906.     # animate boss smoke
  907.     #AnimateSpriteSize(bos_sm0, bos_Start, bos_End, 2.0);
  908.     #AnimateSpriteSize(bos_sm1, bos_Start, bos_End, 2.0);
  909.     #AnimateSpriteSize(bos_sm2, bos_Start, bos_End, 2.0);
  910.  
  911.     # rest for a bit before zoom in
  912.     Sleep(3.0);
  913.  
  914.     # zoom camera in towards boss
  915.     animId = MoveThingToPos(boss_cam1, GetThingPos(targ_PosCam), 12.0);
  916.  
  917. # ********************
  918. # *** kill boss ******
  919. # ********************
  920.  
  921.     # create cooled boss
  922.     boss1 = CreateThing(tpl_Boss1, boss1_Pos);
  923.     CaptureThing(boss1);
  924.     SetThingAlpha(boss1, 0);
  925.     
  926.     # remove boss1 collision
  927.     SetCollideType(boss1, 0);
  928.     
  929.     # prepare boss for cutscene
  930.     AISetCutsceneMode(t_Boss);
  931.  
  932.     # Set AF_IMMOBILE (used to flag 'dont make sparks')
  933.     SetActorFlags(t_Boss, 0x40000);
  934.  
  935.     # move him into position (USER3 = teleport message)
  936.     SendMessageEx(cog_Boss, USER3, t_GhostDie, 0, 0, 0);
  937.     AISetLookThing(t_Boss, boss_Cam1);
  938.     
  939.     PlaySoundThing(snd_BossRoar, boss1, 1.0, 25.0, 50.0, 0);
  940.     
  941.     Sleep(2.0);
  942.     
  943.     # make the boss scream!
  944.     PlaySoundThing(snd_BossDie, boss1, 1.0, 25.0, 50.0, 0);
  945.     
  946.     CreateThing(tpl_Debris, explosion_Pos3);
  947.     CreateThing(tpl_Debris, explosion_Pos4);
  948.     CreateThing(tpl_Debris, explosion_Pos5);
  949.     
  950.     # play die keys
  951.     PlayKey(t_Boss, lb_Die, 4, 0x14, 0);
  952.     PlayKey(boss1, lb_Die, 4, 0x14, 0);
  953.  
  954.     Sleep(2.0);
  955.     
  956.     # make the boss scream!
  957.     PlaySoundThing(snd_BossDie, boss1, 1.0, 25.0, 50.0, 0);
  958.     
  959.     CreateThing(tpl_Debris, explosion_Pos3);
  960.     CreateThing(tpl_Debris, explosion_Pos4);
  961.     CreateThing(tpl_Debris, explosion_Pos5);
  962.     
  963.     Sleep(1.0);
  964.     
  965.     # make the boss scream again!
  966.     PlaySoundThing(snd_BossDie, boss1, 1.0, 25.0, 50.0, 0);
  967.     
  968.     # play flood music cue
  969.     PlaySoundLocal(mus_Flood, 1.0, 0.0, 0x0, 0);
  970.  
  971.     # fade in cooled boss
  972.     ThingFadeAnim(boss1, 0, 1, 3.0, 0);
  973.     
  974.     # show lava pool
  975.     DestroyThing(pud);
  976.     cool = CreateThing(tpl_CoolLava, lava_Puddle);
  977.     CaptureThing(cool);
  978.     cool_Track = MaterialAnim(mat_Cool, 8.0, 0);
  979.     
  980.     Sleep(1.0);
  981.     
  982.     # fade out lava boss
  983.     ThingFadeAnim(t_Boss, 1, 0, 3.0, 0);
  984.     
  985.     #tim
  986.     #Sleep(1.0);
  987.     
  988.     # destroy cool lava puddle
  989.     DestroyThing(cool);
  990.     
  991.     # rest before returing to but_cam1
  992.     WaitForAnimStop(animId);
  993.     Sleep(1.0); # was 2.0
  994.  
  995.     # destroy t_Boss
  996.     DestroyThing(t_Boss);
  997.     
  998.     # force cooled boss to fully opaque
  999.     SetThingAlpha(boss1, 1.0);
  1000.  
  1001.     # turn off look interp
  1002.     SetCameraLookInterp(2, 0);
  1003.     Sleep(0.01);
  1004.     
  1005.     # switch back to button cam
  1006.     SetCameraFocus(2, but_cam1);
  1007.     SetCameraSecondaryFocus(2, targ_butCam);
  1008.     SetCurrentCamera(2);
  1009.     SetCameraFOV(90, 0, 0.0);
  1010.  
  1011.     # set fog to blue
  1012.     SetFog(1, '0.5 0.5 0.6', 10, 350);
  1013.     
  1014.     # restore boss1 collision
  1015.     SetCollideType(boss1, 3);
  1016.  
  1017.     # close both mouths
  1018.     MoveToFrame(mouth1, 0, 1.0);
  1019.     PlaySoundThing(sfx_Mouth, mouth1, 1.0, 15.0, 25.0, 0);
  1020.     MoveToFrame(mouth2, 0, 1.0);
  1021.     WaitForStop(mouth1);
  1022.  
  1023.     # destroy water_Flood
  1024.     DestroyThing(water_Flood);
  1025.     SetThingLight(light_Blue, '0.0 0.0 0.0', 0.001, 1.0);
  1026.  
  1027.     Sleep(1.0);
  1028.  
  1029.     SetCameraPosition(curCam, GetThingPos(but_Cam1));
  1030.     Sleep(0.01);
  1031.     SetCurrentCamera(curCam);
  1032.  
  1033.     ClearActorFlags(player, 0x200000);
  1034.     EndCutscene();
  1035.  
  1036.     return;
  1037.  
  1038. # ========================================================================================
  1039.  
  1040. end
  1041.  
  1042.